package pers.li.controller.goods;

import pers.li.model.Goods;
import pers.li.service.GoodsService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/goods/newGoods.action")
public class NewGoodsController extends HttpServlet {
    private final GoodsService goodsService = new GoodsService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Goods> newGoods = goodsService.getNewGoods(12);
        req.setAttribute("newGoods",newGoods);
        req.getRequestDispatcher("new_goods.jsp").forward(req,resp);
    }
}
